package sys.interaction;

import sys.event.SportingEvent;
import sys.person.AbstractPerson;
import sys.person.Judge;
import sys.ui.JudgeMenu;
import sys.util.PlayerUtil;

import java.util.Scanner;

import static sys.interaction.IteracMain.interMain;

public class IteracJudge {

    static int select;
    public static void interJudge() {

        Scanner input = new Scanner(System.in);
        String id;

        System.out.print("请输入你的学号：");
        id = input.next();

        while (true) {
            JudgeMenu.display();
            select = input.nextInt();
            switch (select) {
                case 1 : {
                    AbstractPerson.browseEvent();
                    break;
                }
                case 2 : {
                    new Judge(id).checkMyEvent();
                    break;
                }
                case 3 : {
                    new Judge(id).checkMyEvent();
                    System.out.print("输入你要评判的项目编号： ");
                    String eventID = input.next();
                    new SportingEvent(eventID).browserPlayer();
                    System.out.print("分别输入你要评判的运动员的学/工号和目标成绩： ");
                    String playerID = input.next();
                    double score = input.nextDouble();
                    new Judge(id, eventID).markForPlayer(playerID, score);
                    System.out.println("评判成功！");
                    System.out.println("判分后：");
                    PlayerUtil.showPlayer(eventID, playerID);

                    break;
                }
                case 0 : {
                    interMain();
                    break;
                }
                default: {
                    System.out.print("请重新输入： ");
                }
            }
        }
    }
}
